package com.wf.netty.coder;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

import java.nio.charset.Charset;
import java.util.List;

/**
 * 功能描述
 *
 * @author wf
 * @since 2022/5/10
 */
public class MyToIntegerReplayingDecoder extends ByteToMessageDecoder {
    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        // 不用判断字节长度
        System.out.println("进入decode");
        int len = in.readableBytes();
        String s = in.readBytes(len).toString(Charset.defaultCharset());
        out.add(666666);
    }
}

